# -*- coding: utf-8 -*-
import tornado.web
import tornado.ioloop
import tornado.httpserver

from tornado.options import define
from app.urls import urls
from app.configs import configs, global_config, options

print('global_config=',global_config)
define("port", type=int, default=global_config['port'])
class Valkyrja(tornado.web.Application):
    def __init__(self):
        super(Valkyrja, self).__init__(handlers=urls, **configs)
# class Valkyrja(MyApplication):
#     def __init__(self):
#         super(Valkyrja, self).__init__(handlers=urls, **configs)

def create_server():
    tornado.options.parse_command_line()
    v = Valkyrja()
    http_server = tornado.httpserver.HTTPServer(v)
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()
